<!-- common start -->
#include("common.html")
<!-- common end -->
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,user-scalable=0,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="format-detection" content="telephone=no" />
<title>留言</title>
<link type="text/css" href="#(tpath)/static/css/css.css" rel="stylesheet"/>
<script type="text/javascript" src="#(tpath)/static/js/jquery.min.js"></script>
<script type="text/javascript" src="#(tpath)/static/js/global.js"></script>
</head>
<body>
    <div id="wrapper">
        <!-- header start -->
        <div id="header">
           <a href="#(base)/" class="home"></a>
           <em>留言</em>
           <a href="#" onclick="$(&quot;#catalog&quot;).toggle();" class="siteMap"></a>
        </div>
		 #include("header.html")
		<!-- header end -->
            <div class="treeBox">
                #category_children_list(categoryId=1)
                #for(category : categorys)
                <a href="#(category.path)">#(category.name)</a>
                #end
                #end
            </div> 
             <div id="page">
            <h1>在线留言 </h1>
            <div class="content">            
            <form id="inputForm" action="#(base)/api/saveForm" method="post">
            <input type="hidden" name="modelId" value="4" />
            <table class="table_form ">
            
            <tr><th width="30%">姓名</th><td width="70%"><input type="text" value="" class="input-text" name="name" id="name" style="width:170px;"></td></tr>
            <tr><th width="30%">QQ</th><td width="70%"><input type="text" value="" class="input-text" name="qq" id="qq" style="width:170px;"></td></tr>
            <tr><th width="30%">留言</th><td width="70%"><textarea style="height:90px;width:170px;" name="content" id="content"></textarea></td></tr>
            <tr><th width="30%">验证码</th><td width="70%"><input type="text" value="" class="input-text" name="captcha" id="captcha" style="width:170px;"><img id="captchaImage" src="#(base)/common/captcha/image" title="点击更换验证码" style="height: 28px;"/></td></tr>
            <tr>
                <th >&nbsp;</th>
                <td ><input type="submit" class="button" value="提 交" name="submit"></td>
            </tr>
            </table>
            </form>
</div>
 </div>
<!-- footer start -->
#include("footer.html")
<!-- footer end -->
</div>
</body>
</html>
<script type="text/javascript">
$(document).ready(function () {
	
    var $captchaImage = $("#captchaImage");
    
    // 更换验证码
    $captchaImage.click(function() {
        $captchaImage.attr("src", "#(base)/common/captcha/image?timestamp=" + new Date().getTime());
    });
    
    
     $("#inputForm").submit(function() {
         var name = $("#name").val();
         if(name == ""){
             alert("请输入您的姓名");
             return false;
         }
         var qq = $("#qq").val();
         if(qq == ""){
             alert("请输入 联系QQ");
             return false;
         }
         var content = $("#content").val();
         if(content == ""){
             alert("请输入 留言内容");
             return false;
         }
         $.ajax({  
                type: $("#inputForm").attr("method"),
                dataType: "json", 
                url: $("#inputForm").attr("action"),
                data: $("#inputForm").serialize(),  
                error: function (data) { },  
                success: function (data){ 
                    if(data.type=="error"){
                        alert(data.msg);
                    }else{
                        alert("留言成功!");
                    }
                }  
            });  
         return false;
     });
    
    
    
});
</script>